package com.wsd.jing.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.wsd.jing.validator.group.InsertGroup;
import com.wsd.jing.validator.group.UpdateGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * All rights Reserved, Designed By www.tom.com
 *
 * @author tom
 * @version 1.0.0
 * @projectName: jing
 * @packageName: com.wsd.jing.entity
 * @className: LoginLog
 * @description: 登录日志
 * @createDate 2022-11-14 07:02
 * @copyright 2022-11-14 07:02 www.tom.com Inc. All rights reserved.
 */
@Getter
@Setter
@ToString
@TableName("j_login_log")
@ApiModel(value = "LoginLog对象", description = "登录日志表")
public class LoginLog implements Serializable {

    private static final long serialVersionUID = 1L;

    @NotNull(message = "登录日志ID不能为空", groups = UpdateGroup.class)
    @Null(message = "登录日志ID为空", groups = InsertGroup.class)
    @ApiModelProperty("登录日志ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @NotBlank(message = "账号不能为空")
    @Length(max = 50, message = "账号不能超过100个字符")
    @ApiModelProperty("账号")
    @TableField("account")
    private String account;

    @Length(max = 50, message = "登录地点不能超过100个字符")
    @ApiModelProperty("登录地点")
    @TableField("location")
    private String location;

    @Length(max = 50, message = "IP地址不能超过100个字符")
    @ApiModelProperty("IP地址")
    @TableField("ip")
    private String ip;

    @Length(max = 50, message = "操作系统不能超过100个字符")
    @ApiModelProperty("操作系统")
    @TableField("system")
    private String system;

    @Length(max = 50, message = "浏览器不能超过100个字符")
    @ApiModelProperty("浏览器")
    @TableField("browser")
    private String browser;

    @NotNull(message = "创建时间不能为空")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty("登录时间")
    @TableField("create_time")
    private LocalDateTime createTime;


}
